from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(651, 540)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        # 菜单栏
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 651, 23))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        # 打开和关闭串口
        self.openPortBtn = QtWidgets.QRadioButton(self.centralwidget)
        self.openPortBtn.setGeometry(QtCore.QRect(10, 8, 71, 22))
        self.openPortBtn.setObjectName("openPortBtn")
        self.closePortBtn = QtWidgets.QRadioButton(self.centralwidget)
        self.closePortBtn.setGeometry(QtCore.QRect(80, 8, 71, 22))
        self.closePortBtn.setObjectName("closePortBtn")
        self.getPortBtn = QtWidgets.QPushButton(self.centralwidget)
        self.getPortBtn.setGeometry(QtCore.QRect(150, 8, 71, 22))
        self.getPortBtn.setObjectName("getPortBtn")
        # 设置串口号等相关信息
        self.portNamelabel = QtWidgets.QLabel(self.centralwidget)
        self.portNamelabel.setGeometry(QtCore.QRect(10, 40, 51, 21))
        self.portNamelabel.setObjectName("portNamelabel")
        self.baudlabel = QtWidgets.QLabel(self.centralwidget)
        self.baudlabel.setGeometry(QtCore.QRect(10, 80, 51, 22))
        self.baudlabel.setObjectName("baudlabel")
        self.bytelabel = QtWidgets.QLabel(self.centralwidget)
        self.bytelabel.setGeometry(QtCore.QRect(10, 120, 51, 22))
        self.bytelabel.setObjectName("bytelabel")
        self.stopBitlabel = QtWidgets.QLabel(self.centralwidget)
        self.stopBitlabel.setGeometry(QtCore.QRect(10, 160, 51, 22))
        self.stopBitlabel.setObjectName("stopBitlabel")
        self.paritylabel = QtWidgets.QLabel(self.centralwidget)
        self.paritylabel.setGeometry(QtCore.QRect(10, 200, 51, 22))
        self.paritylabel.setObjectName("paritylabel")
        self.flowCtrlabel = QtWidgets.QLabel(self.centralwidget)
        self.flowCtrlabel.setGeometry(QtCore.QRect(10, 240, 51, 22))
        self.flowCtrlabel.setObjectName("flowCtrlabel")
        self.portItemsBox = QtWidgets.QComboBox(self.centralwidget)
        self.portItemsBox.setGeometry(QtCore.QRect(60, 40, 161, 22))
        self.portItemsBox.setObjectName("portItemsBox")
        self.baudBox = QtWidgets.QComboBox(self.centralwidget)
        self.baudBox.setGeometry(QtCore.QRect(60, 80, 161, 22))
        self.baudBox.setObjectName("baudBox")
        self.byteBox = QtWidgets.QComboBox(self.centralwidget)
        self.byteBox.setGeometry(QtCore.QRect(60, 120, 161, 22))
        self.byteBox.setObjectName("byteBox")
        self.stopBitBox = QtWidgets.QComboBox(self.centralwidget)
        self.stopBitBox.setGeometry(QtCore.QRect(60, 160, 161, 22))
        self.stopBitBox.setObjectName("stopBitBox")
        self.parityBox = QtWidgets.QComboBox(self.centralwidget)
        self.parityBox.setGeometry(QtCore.QRect(60, 200, 161, 22))
        self.parityBox.setObjectName("parityBox")
        self.flowCtrBox = QtWidgets.QComboBox(self.centralwidget)
        self.flowCtrBox.setGeometry(QtCore.QRect(60, 240, 161, 22))
        self.flowCtrBox.setObjectName("flowCtrBox")
        # DTR & RTS
        self.DTRBox = QtWidgets.QCheckBox(self.centralwidget)
        self.DTRBox.setGeometry(QtCore.QRect(10, 275, 71, 21))
        self.DTRBox.setObjectName("DTRBox")
        self.RTSBox = QtWidgets.QCheckBox(self.centralwidget)
        self.RTSBox.setGeometry(QtCore.QRect(110, 275, 71, 21))
        self.RTSBox.setObjectName("RTSBox")
        # 文本接收框
        self.showDataEdit = QtWidgets.QTextEdit(self.centralwidget)
        self.showDataEdit.setGeometry(QtCore.QRect(230, 10, 401, 281))
        self.showDataEdit.setObjectName("showDataEdit")
        # HEX发送
        self.HEXSendBox = QtWidgets.QCheckBox(self.centralwidget)
        self.HEXSendBox.setGeometry(QtCore.QRect(10, 305, 81, 21))
        self.HEXSendBox.setObjectName("HEXSendBox")
        # 定时发送 & 设置时间
        self.loopSendBox = QtWidgets.QCheckBox(self.centralwidget)
        self.loopSendBox.setGeometry(QtCore.QRect(110, 305, 91, 21))
        self.loopSendBox.setObjectName("loopSendBox")
        self.setTimeEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.setTimeEdit.setGeometry(QtCore.QRect(230, 305, 71, 20))
        self.setTimeEdit.setObjectName("setTimeEdit")
        self.setTimeLabel = QtWidgets.QLabel(self.centralwidget)
        self.setTimeLabel.setGeometry(QtCore.QRect(310, 305, 51, 21))
        self.setTimeLabel.setObjectName("setTimeLabel")
        # 保存 & 清除窗口
        self.saveWinBtn = QtWidgets.QPushButton(self.centralwidget)
        self.saveWinBtn.setGeometry(QtCore.QRect(360, 300, 81, 31))
        self.saveWinBtn.setObjectName("saveWinBtn")
        self.clearWinBtn = QtWidgets.QPushButton(self.centralwidget)
        self.clearWinBtn.setGeometry(QtCore.QRect(460, 300, 81, 31))
        self.clearWinBtn.setObjectName("clearWinBtn")
        # HEX显示
        self.HEXShowBox = QtWidgets.QCheckBox(self.centralwidget)
        self.HEXShowBox.setGeometry(QtCore.QRect(560, 305, 81, 21))
        self.HEXShowBox.setObjectName("HEXShowBox")
        # 字符串输入 & 发送
        self.sendDatalabel = QtWidgets.QLabel(self.centralwidget)
        self.sendDatalabel.setGeometry(QtCore.QRect(10, 340, 81, 31))
        self.sendDatalabel.setObjectName("sendDatalabel")
        self.sendDataEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.sendDataEdit.setGeometry(QtCore.QRect(100, 340, 441, 31))
        self.sendDataEdit.setObjectName("sendDataEdit")
        self.sendDataBtn = QtWidgets.QPushButton(self.centralwidget)
        self.sendDataBtn.setGeometry(QtCore.QRect(560, 340, 81, 31))
        self.sendDataBtn.setObjectName("sendDataBtn")
        # 获取 & 写入参数
        self.getConfigBtn = QtWidgets.QPushButton(self.centralwidget)
        self.getConfigBtn.setGeometry(QtCore.QRect(10, 380, 81, 31))
        self.getConfigBtn.setObjectName("getConfigBtn")
        # self.fileNameEdit = QtWidgets.QLineEdit(self.centralwidget)
        # self.fileNameEdit.setGeometry(QtCore.QRect(100, 380, 441, 31))
        # self.fileNameEdit.setObjectName("fileNameEdit")
        self.snNamelabel = QtWidgets.QLabel(self.centralwidget)
        self.snNamelabel.setGeometry(QtCore.QRect(100, 380, 31, 31))
        self.snNamelabel.setObjectName("snNamelabel")
        self.snNameEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.snNameEdit.setGeometry(QtCore.QRect(130, 380, 81, 31))
        self.snNameEdit.setObjectName("snNameEdit")
        self.IPaddresslabel = QtWidgets.QLabel(self.centralwidget)
        self.IPaddresslabel.setGeometry(QtCore.QRect(238, 380, 41, 31))
        self.IPaddresslabel.setObjectName("IPaddresslabel")
        self.IPaddressEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.IPaddressEdit.setGeometry(QtCore.QRect(280, 380, 121, 31))
        self.IPaddressEdit.setObjectName("IPaddressEdit")  
        self.portNumberlabel = QtWidgets.QLabel(self.centralwidget)
        self.portNumberlabel.setGeometry(QtCore.QRect(420, 380, 41, 31))
        self.portNumberlabel.setObjectName("portNumberlabel")
        self.portNumberEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.portNumberEdit.setGeometry(QtCore.QRect(460, 380, 81, 31))
        self.portNumberEdit.setObjectName("portNumberEdit")
        self.sampleDutylabel = QtWidgets.QLabel(self.centralwidget)
        self.sampleDutylabel.setGeometry(QtCore.QRect(75, 420, 51, 31))
        self.sampleDutylabel.setObjectName("sampleDutylabel")
        self.sampleDutyEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.sampleDutyEdit.setGeometry(QtCore.QRect(130, 420, 61, 31))
        self.sampleDutyEdit.setObjectName("sampleDutyEdit")
        self.sampleSecondlabel = QtWidgets.QLabel(self.centralwidget)
        self.sampleSecondlabel.setGeometry(QtCore.QRect(195, 425, 21, 21))
        self.sampleSecondlabel.setObjectName("sampleSecondlabel")
        self.uploadDutylabel = QtWidgets.QLabel(self.centralwidget)
        self.uploadDutylabel.setGeometry(QtCore.QRect(227, 420, 61, 31))
        self.uploadDutylabel.setObjectName("uploadDutylabel")        
        self.uploadDutyEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.uploadDutyEdit.setGeometry(QtCore.QRect(280, 420, 81, 31))
        self.uploadDutyEdit.setObjectName("uploadDutyEdit")
        self.uploadSecondlabel = QtWidgets.QLabel(self.centralwidget)
        self.uploadSecondlabel.setGeometry(QtCore.QRect(365, 425, 21, 21))
        self.uploadSecondlabel.setObjectName("uploadSecondlabel")
        self.configTipslabel = QtWidgets.QLabel(self.centralwidget)
        self.configTipslabel.setGeometry(QtCore.QRect(75, 455, 500, 21))
        self.configTipslabel.setObjectName("configTipslabel")        
        self.setConfigBtn = QtWidgets.QPushButton(self.centralwidget)
        self.setConfigBtn.setGeometry(QtCore.QRect(560, 380, 81, 31))
        self.setConfigBtn.setObjectName("setConfigBtn")
        # 所打开的串口信息
        self.portInfolabel = QtWidgets.QLabel(self.centralwidget)
        self.portInfolabel.setGeometry(QtCore.QRect(10, 480, 591, 21))
        self.portInfolabel.setObjectName("portInfolabel")
        self.sendBytelabel = QtWidgets.QLabel(self.centralwidget)
        self.sendBytelabel.setGeometry(QtCore.QRect(10, 500, 71, 21))
        self.sendBytelabel.setObjectName("sendBytelabel")
        self.getBytelabel = QtWidgets.QLabel(self.centralwidget)
        self.getBytelabel.setGeometry(QtCore.QRect(90, 500, 71, 21))
        self.getBytelabel.setObjectName("getBytelabel")
        # 底部信息栏
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))        
        self.openPortBtn.setText(_translate("MainWindow", "打开串口"))
        self.closePortBtn.setText(_translate("MainWindow", "关闭串口"))
        self.getPortBtn.setText(_translate("MainWindow", "刷新串口"))        
        self.portNamelabel.setText(_translate("MainWindow", "串口号"))
        self.baudlabel.setText(_translate("MainWindow", "波特率"))
        self.bytelabel.setText(_translate("MainWindow", "数据位"))
        self.stopBitlabel.setText(_translate("MainWindow", "停止位"))
        self.paritylabel.setText(_translate("MainWindow", "校验位"))
        self.flowCtrlabel.setText(_translate("MainWindow", "流控制"))
        self.DTRBox.setText(_translate("MainWindow", "DTR"))
        self.RTSBox.setText(_translate("MainWindow", "RTS"))
        self.HEXSendBox.setText(_translate("MainWindow", "HEX发送"))
        self.loopSendBox.setText(_translate("MainWindow", "定时发送"))        
        self.setTimeLabel.setText(_translate("MainWindow", "ms/次"))
        self.saveWinBtn.setText(_translate("MainWindow", "保存窗口"))
        self.clearWinBtn.setText(_translate("MainWindow", "清除窗口"))
        self.HEXShowBox.setText(_translate("MainWindow", "HEX显示"))
        self.sendDatalabel.setText(_translate("MainWindow", "字符串输入"))
        self.sendDataBtn.setText(_translate("MainWindow", "发送"))
        self.getConfigBtn.setText(_translate("MainWindow", "获取参数"))
        self.snNamelabel.setText(_translate("MainWindow", "SN码"))
        self.snNameEdit.setPlaceholderText(_translate("MainWindow", "001PCH"))
        self.IPaddresslabel.setText(_translate("MainWindow", "IP地址"))
        self.IPaddressEdit.setPlaceholderText(_translate("MainWindow", "120.76.154.250"))
        self.portNumberlabel.setText(_translate("MainWindow", "端口号"))
        self.portNumberEdit.setPlaceholderText(_translate("MainWindow", "1883"))
        self.sampleDutylabel.setText(_translate("MainWindow", "采样周期"))
        self.sampleDutyEdit.setPlaceholderText(_translate("MainWindow", "900"))        
        self.sampleSecondlabel.setText(_translate("MainWindow", "秒"))
        self.uploadDutylabel.setText(_translate("MainWindow", "上传周期"))
        self.uploadDutyEdit.setPlaceholderText(_translate("MainWindow", "86400"))
        self.uploadSecondlabel.setText(_translate("MainWindow", "秒"))
        self.configTipslabel.setText(_translate("MainWindow", "TIPS：若以上某参数项输入框内未输入内容，则该参数默认设置为输入框中所提示的内容"))
        self.setConfigBtn.setText(_translate("MainWindow", "写入参数"))
        self.portInfolabel.setText(_translate("MainWindow", "串口信息"))
        self.sendBytelabel.setText(_translate("MainWindow", "S:0"))
        self.getBytelabel.setText(_translate("MainWindow", "R:0"))